<!DOCTYPE html>
{extend name="common/application" /}
{block name="title"}<title>个人中心-申诉</title>{/block}
{block name="css"}
<link rel="stylesheet" type="text/css" href="_CSS_/help.css" />
<link rel="stylesheet" type="text/css" href="_CSS_/complain.css"/>
<style>
.nodatas{text-align: center;padding: 100px 0;}
.nodatas img{display: inline-block;margin-top: 100px;margin-bottom: 20px;}
</style>
{/block}
<!-- 主体内容 -->
{block name="content"}

			<!-- 主体内容 -->
			<div class="main">
				<div class="mainBody normalBox clearfix">
					<!--左菜单-->
					<ul class="menuList fl">
						<li>
							<a class="menuItem dropBg" href="personal.html"><span class="icons icon-account"></span>账户管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="personal.html">个人资料</a>
								<a class="menuchildItem" href="certification.html">实名认证</a>
								<a class="menuchildItem" href="account.html">账户安全</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="order.html"><span class="icons icon-order"></span>我的订单</a>
							<div class="childMenu">
								<a class="menuchildItem" href="order.html">我的订单</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="collect_news.html"><span class="icons icon-collection"></span>我的收藏</a>
							<div class="childMenu">
								<a class="menuchildItem" href="collect_news.html">资讯收藏</a>
								<a class="menuchildItem" href="collect_course.html">课程收藏</a>
								<a class="menuchildItem" href="collect_products.html">商品收藏</a>
								<a class="menuchildItem" href="collect_stores.html">店铺收藏</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="address.html"><span class="icons icon-address"></span>地址管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="address.html">地址管理</a>
							</div>
						</li>
						<li>
							<a class="menuItem dropBg" href="judge.html"><span class="icons icon-evaluate"></span>评价管理</a>
							<div class="childMenu">
								<a class="menuchildItem" href="judge.html">评价管理</a>
							</div>
						</li>
						<li class="showChild">
							<a class="menuItem dropBg" href="complain.html"><span class="icons icon-price"></span>申述退款</a>
							<div class="childMenu">
								<a class="menuchildItem activeMenu" href="complain.html">申述</a>
								<a class="menuchildItem" href="refund_money.html">退款</a>
							</div>
						</li>
						<li class="bb0">
							<a class="menuItem dropBg" href="message.html"><span class="icons icon-news"></span>消息中心</a>
							<div class="childMenu">
								<a class="menuchildItem" href="message.html">消息中心</a>
							</div>
						</li>
					</ul>
					<!--右内容-->
					<div class="menuContent fr">
						<div class="menuConHeader">
							<!--面包屑导航-->
							<div class="breadcrumb">
								<p>当前位置：
									<a href="complain.html">申诉退款</a> &gt;
									<a class="curPage" href="javascript:;">申诉</a>
								</p>
							</div>
						</div>
						<input type="hidden" id="value">
						<div class="menuConBody">
							<!--二次筛选-->
							<div class="sec_tab">
								<a class="secType active_01" href="javascript:;">全部<span></span></a>
								<a class="secType" href="javascript:;">未处理<span></span></a>
								<a class="secType" href="javascript:;">处理中<span></span></a>
								<a class="secType" href="javascript:;">已完成<span></span></a>
							</div>
							<table class="tableList" border="1">
								<thead>
									<tr class="thead">
										
									</tr>
								</thead>
								<tbody>

							
								</tbody>

							</table>
							<div id="page"></div>
						</div>
					</div>
				</div>
			</div>
{/block}



{block name="js"}
		<script src="_P_/layer/layer.js"></script>

		<script type="text/javascript">
			$(document).ready(function(){
				postfile(1, 0);
				/*二级导航*/
				$('.secType').on('click',function(){
					$('.secType').removeClass('active_01');
					$(this).addClass('active_01');
					var num = $(".menuConBody a").index(this);
					$("#value").val(num);
					postfile(1, num);
				});


			});
			function postfile(page, value) {
				var userinfo = $.cookie('userinfo');
				if (userinfo != null) {
					var user_login = $.base64.decode(userinfo).split(",");
					$.ajax({
						type: "get",
						url: "{:url('api/form/complain')}",
						data: {'uid': user_login[0], 'page': page, 'static': value},
						dataType: 'jsonp',
						success: function (msg) {
							if (msg.code == 200) {
								$("tbody").html("");
								if (msg.data.data.length != 0) {
									$('tr.thead').html('<th width="20%">订单编号</th><th width="30%">问题描述</th><th width="20%">申诉时间</th><th width="15%">申诉状态</th><th width="15%">操作</th>');
									for (var i = 0; i < msg.data.data.length; i++) {
										var html = ' <tr class="items" num="' + msg.data.data[i].id + '"><td>' + msg.data.data[i].order + '</td><td class="content">' + msg.data.data[i].problem + '</td>';
										if (msg.data.data[i].static == 1) {
											html += '<td>' + getMyDate(msg.data.data[i].time * 1000) + '</td><td>未处理</td>';
										} else if (msg.data.data[i].static == 2) {
											html += '<td>' + getMyDate(msg.data.data[i].time * 1000) + '</td><td>待处理</td>';
										} else if (msg.data.data[i].static == 3 || msg.data.data[i].static == 4) {
											html += '<td>' + getMyDate(msg.data.data[i].time * 1000) + '</td><td>已处理</td>';
										}
										html += '<td><a class="goDetails" href="javascript:;">查看详情</a></tr>';
										$("tbody").append(html);
									}
									for(var j=0;j<msg.data.num.length;j++){
										if(msg.data.num[j].static==1){
											$('.secType').eq(1).find('span').html(msg.data.num[j].number);
										}
										if(msg.data.num[j].static==2){
											$('.secType').eq(2).find('span').html(msg.data.num[j].number);
										}
										if(msg.data.num[j].static==3){
											$('.secType').eq(3).find('span').html(msg.data.num[j].number);
										}
									}
									$('.secType').eq(0).find('span').html(msg.data.count0);
									$('.secType').eq(1).find('span').html(msg.data.count1);
									$('.secType').eq(2).find('span').html(msg.data.count2);
									$('.secType').eq(3).find('span').html(msg.data.count3);
									if (msg.data.count == 0) {
										$('#page').html('');
									} else {
										$('#page').html(msg.data.render);
										$("#pagination").delegate("a", "click", function () {
											var num = $(this).attr("num");
											var value = $("#value").val();
											
											if (num) {
												postfile(num, value);
											}
										});
										var pages = Math.ceil(msg.data.count / 10);
										$("#GO").on('click',function(){
											var king = $("#go").val();
											if(king > pages){
												layer.alert("最多输入"+pages+"页");
												return;
											}
											postfile(king, value);
										});
									}
								} else {
									$("#page").html("");
									$("tbody").html("<div class='nodatas'><img src='/static/web/images/nodata.png'/><p>抱歉，找不到相关数据</p></div>");
									$('tr.thead').html("");
								}
								/*查看详情*/
								$('.goDetails').on('click',function(){
									var id=$(this).parents('.items').attr('num');
									$.ajax({
										type: "get",
										url: "{:url('api/shop/details')}",
										data: {id: id},
										dataType: 'jsonp',
										success: function (msg) {
											if (msg.code == 200) {
												var king='';var result;
												if(msg.data.pic){
													var val = JSON.parse(msg.data.pic).join(",").split(",");
													for (var i = 0; i < val.length; i++) {
														 king += '<img src="/Images/appeal/' + val[i] + '">';
													}
												}
												if (msg.data.result == null) {
													result='暂无';
												} else {
													result=msg.data.result;
												}
												layer.open({
													type: 1,
													title: '查看详情',
													closeBtn: false,
													shadeClose: true,
													scrollbar: false,
													area: ['600px', '400px'],
													content: "<div class='forms' id='details'><div class='form-group'><label>订单编号：</label><span class='orderNumber'>"+msg.data.order+"</span></div><div class='form-group'><label>问题描述：</label><span>"+msg.data.problem+"</span></div><div class='form-group'><label>证据上传：</label>"+king+"</div><div class='form-group'><label>联系人：</label><span>"+msg.data.nick+"</span></div><div class='form-group'><label>手机号码：</label><span>"+msg.data.phone+"</span></div><div class='form-group'><label>处理结果：</label><span>"+result+"</span></div></div>",
//				        btn: ['发送', '取消'],
													yes: function(index, layero) {
														//do something
														layer.close(index); //如果设定了yes回调，需进行手工关闭
													}
												});
											}
										}
									});

								});
							}
						}
					})
				} else {
					window.location.href = "{:url('index/login/index')}";
				}
			}
		</script>
{/block}


